import QtQuick
import QtQuick.Layouts
import QtCharts

Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    ChartView {
        id: chartView
        title: "分类坐标轴示例"
        titleFont.bold: true
        titleFont.pointSize: 14

        anchors.fill: parent
        antialiasing: true

        CategoryAxis {
            id: valueAxisX
            min: 0
            max: 30
            CategoryRange {
                label: "前段"
                endValue: 10
            }
            CategoryRange {
                label: "中段"
                endValue: 20
            }
            CategoryRange {
                label: "后段"
                endValue: 30
            }
        }

        CategoryAxis {
            id: valueAxisY
            min: 0
            max: 40
            CategoryRange {
                label: "低"
                endValue: 10
            }
            CategoryRange {
                label: "中"
                endValue: 20
            }
            CategoryRange {
                label: "高"
                endValue: 30
            }
            CategoryRange {
                label: "极端"
                endValue: 40
            }
        }

        LineSeries {
            name: "line"
            XYPoint { x: 0; y: 3 }
            XYPoint { x: 4; y: 8 }
            XYPoint { x: 12; y: 18 }
            XYPoint { x: 24; y: 22 }
            XYPoint { x: 30; y: 25 }

            axisX: valueAxisX
            axisY: valueAxisY
        }
    }
}
